﻿import gs.TweenLite;
import mx.utils.Delegate;
class cn.eminia.AS2.Bo4 {
	function Bo4(btn, act, obj) {
		/*btn.onEnterFrame = function() {
			this.gotoAndStop(1); 
			delete this.onEnterFrame;
		};*/
		var btn_ = btn;
		btn.onRollOver = function() {
			this.gotoAndStop(2);
		};
		btn.onRollOut = btn.onReleaseOutside=function () {
			this.gotoAndStop(1);
		};
		btn.onPress = function() {
			this.gotoAndStop(3);
		};
		btn.onRelease = (act == undefined) ? null : Delegate.create(btn_, act);
		//附加属性
		if (obj != undefined) {
			for (var i in obj) {
				btn_[i] = obj[i];
			}
		}
	}  
	static function record(btn) {
		btn._onRollOut = btn.onRollOut;
		btn._onRollOver = btn.onRollOver;
		btn._onRelease = btn.onRelease;
		btn._onReleaseOutside = btn.onReleaseOutside;
		btn._onPress = btn.onPress; 
	}
	static function del(btn) {
		delete btn.onRollOut;
		delete btn.onRollOver;
		delete btn.onRelease;
		delete btn.onReleaseOutside;
		delete btn.onPress;
	}
	static function reback(btn) {
		btn.onRollOut = btn._onRollOut;
		btn.onRollOver = btn._onRollOver;
		btn.onRelease = btn._onRelease;
		btn.onReleaseOutside = btn._onReleaseOutside;
		btn.onPress = btn._onPress; 
	}
}